package com.k2data.test.parameterized;

/**
 * 
 * @author wangchuan 2019-01-28
 *
 */
public class Point {
	private Double x;
	private Double y;

	@Override
	public String toString() {
		return "Point: {x=" + this.x + ", y=" + this.y + "}";
	}
	
	/**
	 * 
	 * @param x
	 * @param y
	 */
	public Point(Double x, Double y){
		this.x = x;
		this.y = y;
	}
	
	/**
	 * 
	 * @param pointString
	 * @return
	 */
	public static Point from(String pointString) {
		String subString = pointString.substring(1, pointString.length() - 1);
		String[] values = subString.split("/");
		Double x = Double.parseDouble(values[0]);
		Double y = Double.parseDouble(values[1]);
		
		return new Point(x, y);
	}
}
